Skip to content

feat(orchestrator): adopt QueueBatchStateStore for batch state reads and writes - #525

Merged
behinddwalls merged 2 commits into
mainfrom
preetam/partition-by-queue
Aug 6, 2026
Merged

feat(orchestrator): adopt QueueBatchStateStore for batch state reads and writes#525
behinddwalls merged 2 commits into
mainfrom
preetam/partition-by-queue

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

BatchStore.GetByQueueAndStates was the storage contract's last query-by-attribute, backed by the schema's only secondary index (idx_queue_state). The queue's per-state membership records (QueueBatchStateStore) exist to replace it with pure by-key reads, but had no callers yet.

What?

Every batch state write now goes through the shared transition protocol in submitqueue/core/batch: Transition in the batch (Creating→Created), speculate (Speculating/Merging/Failed/Cancelled), mergesignal (terminal), cancel (Cancelling), and DLQ (Failed) controllers, with EnsureRecord repairing records after batch creation and on idempotent redelivery skip branches. The batch controller's dependency read goes through core/batch.ListByStates over the record buckets. GetByQueueAndStates is deleted from the contract, MySQL implementation, and mock, and idx_queue_state is dropped from the batch schema, so the batch table is pure get/put-by-key. Also repairs three stale controller tests that no longer matched the current control flow (they fail at the parent commit as well).

Test Plan

go test ./... (only pre-existing runway git-merger environment failures remain; they fail at the parent commit too) ✅ make fmtmake lintmake gazellemake mocks ✅ storage + orchestrator integration suites via make integration-test targets.

Stack

  1. @ feat(orchestrator): adopt QueueBatchStateStore for batch state reads and writes #525
  2. feat(orchestrator): carry the queue explicitly on every internal payload #527

…and writes

## Summary

### Why?

`BatchStore.GetByQueueAndStates` was the storage contract's last query-by-attribute, backed by the schema's only secondary index (`idx_queue_state`). The queue's per-state membership records (`QueueBatchStateStore`) exist to replace it with pure by-key reads, but had no callers yet.

### What?

Every batch state write now goes through the shared transition protocol in `submitqueue/core/batch`: `Transition` in the batch (Creating→Created), speculate (Speculating/Merging/Failed/Cancelled), mergesignal (terminal), cancel (Cancelling), and DLQ (Failed) controllers, with `EnsureRecord` repairing records after batch creation and on idempotent redelivery skip branches. The batch controller's dependency read goes through `core/batch.ListByStates` over the record buckets. `GetByQueueAndStates` is deleted from the contract, MySQL implementation, and mock, and `idx_queue_state` is dropped from the batch schema, so the batch table is pure get/put-by-key. Also repairs three stale controller tests that no longer matched the current control flow (they fail at the parent commit as well).

## Test Plan

✅ `go test ./...` (only pre-existing runway git-merger environment failures remain; they fail at the parent commit too) ✅ `make fmt` ✅ `make lint` ✅ `make gazelle` ✅ `make mocks` ✅ storage + orchestrator integration suites via `make integration-test` targets.
@behinddwalls
behinddwalls marked this pull request as ready for review August 6, 2026 14:39
@behinddwalls
behinddwalls requested review from a team and sbalabanov as code owners August 6, 2026 14:39
@behinddwalls
behinddwalls marked this pull request as draft August 6, 2026 15:59
@behinddwalls
behinddwalls marked this pull request as ready for review August 6, 2026 16:16
@behinddwalls
behinddwalls merged commit a08ae64 into main Aug 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants